# 基本使用步骤:
# 	1.导入Resource, Api
# 	2.创建api对象，并关联app
# 	3.定义视图类
# 	4.使用api对象绑定路由和视图

from flask import Flask
# 1.导入Resource, Api
from flask_restful import Resource, Api


app = Flask(__name__)
# 2.创建api对象,并关联app
api = Api(app)

# 3.定义视图类
class Hello(Resource):
    def get(self):
        return {'msg': 'hello world'}

# 4.使用api对象绑定路由和视图
api.add_resource(Hello, '/')

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0', port=5000)
